package com.ddwl.user.dao;

import com.ddwl.common.dao.TkDao;
import com.ddwl.schema.bo.user.AuditConfigPageBo;
import com.ddwl.user.dao.mapper.AuditConfigMapper;
import com.ddwl.user.model.AuditConfig;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author hemiaojun
 * @Date 2020/9/29 13:32
 */
@Repository
public class AuditConfigDao extends TkDao<AuditConfigMapper,AuditConfig> {

    @Resource
    private AuditConfigMapper auditConfigMapper;

    public AuditConfig queryByOsAndVersionAndChannel(AuditConfig entity) {
        return selectOne(entity);
    }

    public List<AuditConfig> getList(AuditConfigPageBo bo) {
        Example example=getExample();
        example.and().andEqualTo("channel", bo.getChannel())
                .andEqualTo("os", bo.getOs())
                .andEqualTo("status", bo.getStatus())
                .andEqualTo("version", bo.getVersion());
        return auditConfigMapper.selectByExample(example);
    }

    public List<AuditConfig> getAll() {
        return auditConfigMapper.selectAll();
    }

    public void changeId(Map<String, String> map) {
        auditConfigMapper.changeId(map);
    }
}
